package com.ark.mapper;

import com.ark.entity.DishFlavor;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper extends BaseMapper<DishFlavor> {


    /**
     * 根据菜品id查询对应的口味数据
     * @param id 菜品id
     * @return 口味数据
     */
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getByDishId(Long id);

    /**
     * 根据菜品id批量删除关联的口味数据
     * @param dishIds 菜品id集合
     */
    Integer deleteByDishIds(List<Long> dishIds);

    /**
     * 根据菜品id删除口味数据
     * @param dishId 菜品id
     * @return 影响条数
     */
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    Integer deleteByDishId(Long dishId);
}
